 <meta charset="utf-8">
 <div class="box" id="biz_authPermission_conatainer">
            <div class="box-header with-border">
               <form id="searchForm" role="form" class="form-inline">
                    <div class="form-group">
                         <label>权限名称</label>
                         <input name="name"  v-model="searchForm.name"  v-bind:value="searchForm.name"  type="text" placeholder="" class="form-control">
                    </div>
                    <div class="form-group">
                    <label>权限代码</label>
                         <input name="permCode" v-model="searchForm.permCode" v-bind:value="searchForm.permCode"  type="text" placeholder="" class="form-control">
                    </div>
                    
                    <div class="form-group" >
					 <label>所属应用</label>
						 <select id="appKey" name="appKey" v-model="searchForm.appKey"   
						    v-kselect="{url:'auth/authApp/loadAuthAppComboboVo',vmodel:'searchForm.appKey',firstEmpty:'true'}" class=" form-control"> </select>
					</div>
				
					 <div class="form-group" >
					 <label>所属模块</label>
						 <select id="moduleId"  name="moduleId" v-model="searchForm.moduleId" 
						    v-kselect="{url:'auth/authModule/loadModuleComboboVo',vmodel:'searchForm.moduleId',linkToDomId:'appKey',ajaxParamKey:'appKey',firstEmpty:'true'}" class=" form-control"> </select>
					</div>  
              
                  <button type="button"  class="btn btn-info pull-right m-t-n-xs" v-kperms="{perm:''}" v-on:click="search"><strong>查询</strong></button>
                </form>
            </div>
 <div class="box-body">
 	<div class="row">
 	  <div class="col-md-12">
 	                       <div class="btn-group " id="authPermTableToolbar" role="group">
 	                       			<button type="button" v-kperms="{perm:'authPermission:addPermission'}"  class="btn btn-default" v-on:click="add">
                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加
                                    </button>
                                    
                                     <button type="button"  v-kperms="{perm:'authPermission:updatePermission'}" class="btn btn-default" v-on:click="edit">
                                        <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改
                                    </button>
                                  
                                    <button type="button"  v-kperms="{perm:'authPermission:deletAuthPermission'}" class="btn btn-default" v-on:click="deletex">
                                        <i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除
                                    </button>
                                     <button type="button"  v-kperms="{perm:'authPermission:setPermissionEnabled'}" class="btn btn-default" v-on:click="setEnable">
                                        <i class="glyphicon glyphicon-ok" aria-hidden="true"></i> 启用
                                    </button>
                                     <button type="button"  v-kperms="{perm:'authPermission:setPermissionEnabled'}" class="btn btn-default" v-on:click="setDisable">
                                        <i class="glyphicon glyphicon-remove" aria-hidden="true"></i> 禁用
                                    </button>
                           </div>
                                
           <table id="ahthPermBootstrapTable" data-mobile-responsive="true" ></table>
 	  </div>
 	</div>
 </div>
 </div>
<script>
var newa=new Vue({  
	  el: '#biz_authPermission_conatainer', 
	  data:{
		  searchForm:{
			  name: null,
			  permCode: null,
			  appKey: null,
			  moduleId: null
		  },
	      bus:new Vue()
	  },
	  mounted:function(){
		 let _this=this;
		 _this.bus.$once(zfesVueDirective.getKselectOnInitEventName("moduleId"), function (msg) {
				_this.initTable();
			
		 });
	  },
    methods: {
  	  initTable:function(){
  		  let columns=[
  				{checkbox:true},
				{field:'permCode',title:'权限编码',width:160,sortable:true},
				{field:'name',title:'权限名称',width:160},
				{field:'enabled',title:'是否启用',width:60,formatter:zfesUtil.formatEnabled},
				{field:'moduleName',title:'所属模块',width:80},
				{field:'appName',title:'所属应用',width:80},
				{field:'url',title:'权限地址',width:280},
				{field:'description',title:'权限描述',width:200}];
  		  let url="auth/authPermission/loadAuthPermissionList";
  		console.log("searchForm|"+ JSON.stringify(this.searchForm));
    		zfesBstable.laodTable($("#ahthPermBootstrapTable"),$("#searchForm"),$("#authPermTableToolbar"),url,columns,this.searchForm);
  	  },
  	  search:function(){
  		console.log("searchForm|"+ JSON.stringify(this.searchForm));
  		  zfesBstable.reload($("#ahthPermBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#ahthPermBootstrapTable"));
  	  },
  	  add:function(){
  		 let　_this=this;
  		 var url="/view/auth/authPermission/authPermission.add.html";
  		 zfesLayerEditDg.open(url,{},"权限信息编辑",460,function(){_this.refresh();});
  		 
  	  },
  	  edit:function(){
  		  if(zfesBstable.isOneRow($("#ahthPermBootstrapTable"))){
  			  let　_this=this;
  			  let id=zfesBstable.getRowId($("#ahthPermBootstrapTable"));
  			  let url="/view/auth/authPermission/authPermission.edit.html";
  			  zfesLayerEditDg.open(url,{"id":id},"权限信息编辑",600,function(){_this.refresh();}); 
  		 }
  	  },
  	  setEnable:function(){
  		  if(zfesBstable.isSelectedRow($("#ahthPermBootstrapTable"))){
  			  let ids=zfesBstable.getRowIds($("#ahthPermBootstrapTable"));
  			  let　_this=this;
  				 alertSwal.confirm("启用","是否执行该操作",function(){
						    let ajaxUrl = "auth/authPermission/setPermissionEnabled";
						    zfesAjax.ajaxTodo(ajaxUrl, { "ids" : ids,"enabled":true}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
							});
						});
  		  }
  	  },
  	  setDisable:function(){
  		  if(zfesBstable.isSelectedRow($("#ahthPermBootstrapTable"))){
  			  let ids=zfesBstable.getRowIds($("#ahthPermBootstrapTable"));
  			  let　_this=this;
  				 alertSwal.confirm("禁用","是否执行该操作",function(){
						    let ajaxUrl = "auth/authPermission/setPermissionEnabled";
						    zfesAjax.ajaxTodo(ajaxUrl, { "ids" : ids,"enabled":false}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
						});
  		  		});
  		  }
  	  },
  	  deletex:function(){
  			if(zfesBstable.isOneRow($("#ahthPermBootstrapTable"))){
  				  let　_this=this;
  					var id=zfesBstable.getRowId($("#ahthPermBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该应用",function(){
  						    let ajaxUrl = "auth/authPermission/deletAuthPermission";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							},function(data){
  								
  							}); 
  				});
  			}
  				
  	  }
   	
   }

});
</script>


